#pragma once

#include "../Utilities/utilities.h"
#include "Shaders.h"
#include "Camera.h"
#include "Vertex.h"
#include "Object.h"


class Terrain :
	public Object
{
private:
	int vertRows;
	int vertCols;

	float width, height;
	GLuint tex_blend_id, tex_low_id, tex_med_id, tex_high_id, tex_normal_id;
	GLuint id[5];
	void GenerateTriangleGrid(int vertRows, int vertCols, float dx, float dz,
		const Vector3 center);
	void GenerateNormals();
	float filterEach(int x, int y);
	void filterAll();
public:
	int Load (Vector3 center, char* height_map, char* blend_map, char* tex_low_tga, char* tex_med_tga, char* tex_high_tga, char* tex_normal_map);
	int LoadRAW(int nVertCols, int nVertRows, char* file_name, float height_scale, float height_offset);
	void Draw( ESContext *esContext, Camera * camera);
	void Update ( ESContext *esContext, float deltaTime);
	Terrain(void);
	~Terrain(void);
};
